package com.rc.saas.tenant.common.enums;

/**
 * Create by Yang on 2021/11/23
 */
public enum YkrPileStopReasonEnum {

    YkrWarnCodeEnum_0(0, "用户手动停止充电"),
    YkrWarnCodeEnum_1(1, "充电枪断开停止充电"),
    YkrWarnCodeEnum_2(2, "输出过压停止充电"),
    YkrWarnCodeEnum_3(3, "输出过流停止充电"),
    YkrWarnCodeEnum_4(4, "充电机输出不可控停机"),
    YkrWarnCodeEnum_5(5, "充电机风扇故障"),
    YkrWarnCodeEnum_6(6, "车辆SOC达到设定值(BMS中止充电)"),
    YkrWarnCodeEnum_7(7, "车辆电池总电压达到设定值(BMS中止充电)"),
    YkrWarnCodeEnum_8(8, "车辆单体电池电压达到设定值(BMS中止充电)"),
    YkrWarnCodeEnum_9(9, "车辆绝缘故障(BMS中止充电)"),
    YkrWarnCodeEnum_10(10, "车辆连接器过温(BMS中止充电)"),
    YkrWarnCodeEnum_11(11, "BMS元件、输出连接器过温(BMS中止充电)"),
    YkrWarnCodeEnum_12(12, "车辆连接器故障(BMS中止充电)"),
    YkrWarnCodeEnum_13(13, "车辆电池过温(BMS中止充电)"),
    YkrWarnCodeEnum_14(14, "车辆其他故障(BMS中止充电)"),
    YkrWarnCodeEnum_15(15, "车辆充电过流(BMS中止充电)"),
    YkrWarnCodeEnum_16(16, "车辆充电电压异常(BMS中止充电)"),
    YkrWarnCodeEnum_17(17, "车辆BMS通信异常"),
    YkrWarnCodeEnum_18(18, "充电机DC20通信失败停机"),
    YkrWarnCodeEnum_19(19, "交流断路器故障"),
    YkrWarnCodeEnum_20(20, "充电机RC10通信失败停机"),
    YkrWarnCodeEnum_21(21, "充电机紧急停机"),
    YkrWarnCodeEnum_22(22, "电度表通信中断停机"),
    YkrWarnCodeEnum_23(23, "计量异常停机"),
    YkrWarnCodeEnum_24(24, "预充失败"),
    YkrWarnCodeEnum_25(25, "电池反接充电机主动停机"),
    YkrWarnCodeEnum_26(26, "交流输入过压充电机主动停机"),
    YkrWarnCodeEnum_27(27, "交流输入欠压充电机主动停机"),
    YkrWarnCodeEnum_28(28, "交流输入缺相充电机主动停机"),
    YkrWarnCodeEnum_29(29, "防雷故障主动停机"),
    YkrWarnCodeEnum_30(30, "充电机内部过温主动停机"),
    YkrWarnCodeEnum_31(31, "充电机通信中断停机"),
    YkrWarnCodeEnum_32(32, "充电机输出欠压停机"),
    YkrWarnCodeEnum_33(33, "直流输出开关断开"),
    YkrWarnCodeEnum_34(34, "熔断器故障停机"),
    YkrWarnCodeEnum_35(35, "泄放回路故障"),
    YkrWarnCodeEnum_36(36, "充电机输出短路停机"),
    YkrWarnCodeEnum_37(37, "充电机模块故障停机"),
    YkrWarnCodeEnum_38(38, "电流采样异常停机"),
    YkrWarnCodeEnum_39(39, "交流接触器故障"),
    YkrWarnCodeEnum_40(40, "并联接触器故障"),
    YkrWarnCodeEnum_41(41, "直流接触器故障"),
    YkrWarnCodeEnum_42(42, "充电机绝缘故障停机"),
    YkrWarnCodeEnum_43(43, "环境采集模块通信中断"),
    YkrWarnCodeEnum_44(44, "充电枪过温停机"),
    YkrWarnCodeEnum_45(45, "输出电压超过最高允许充电电压停机"),
    YkrWarnCodeEnum_46(46, "余额不足停机"),
    YkrWarnCodeEnum_47(47, "柜门打开充电机主动停机"),
    YkrWarnCodeEnum_48(48, "达到充电桩设定SOC停机"),
    YkrWarnCodeEnum_49(49, "达到设定电量停机"),
    YkrWarnCodeEnum_50(50, "达到设定时间停机"),
    YkrWarnCodeEnum_51(51, "达到设定金额停机"),
    YkrWarnCodeEnum_52(52, "过电量保护停机"),
    YkrWarnCodeEnum_53(53, "充电桩过温停机"),
    YkrWarnCodeEnum_54(54, "后台通信异常停机"),
    YkrWarnCodeEnum_55(55, "未检测到电池电压"),
    YkrWarnCodeEnum_56(56, "充电机处于手动状态"),
    YkrWarnCodeEnum_57(57, "枪锁故障"),
    YkrWarnCodeEnum_58(58, "车内接触器粘连"),
    YkrWarnCodeEnum_59(59, "充电机启动超时"),
    YkrWarnCodeEnum_60(60, "收到后台命令停机-APP停机"),
    YkrWarnCodeEnum_61(61, "8枪投切主板通信中断"),
    YkrWarnCodeEnum_62(62, "收到后台命令停机-集团卡VIN与后台不一致"),
    YkrWarnCodeEnum_63(63, "收到后台命令停机-账号被冻结");

    YkrPileStopReasonEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }


    ///**
    // * 解析code
    // *
    // * @param code
    // * @return
    // */
    //public static String getElecPileStopReasonResult(String code) {
    //    Integer intCode = Integer.parseInt(code, 16);
    //    Class<YkrPileStopReasonEnum> enumClass = YkrPileStopReasonEnum.class;
    //    for (YkrPileStopReasonEnum elecPileStopReasonEnum : enumClass.getEnumConstants()) {
    //        if (intCode == elecPileStopReasonEnum.getCode()) {
    //            return elecPileStopReasonEnum.getMsg();
    //        }
    //    }
    //    return "该停止方式未知:" + intCode;
    //
    //}


    /**
     * 解析code
     *
     * @param
     * @return
     */
    public static String getElecPileStopReasonResult(Integer intCode) {
        //Integer intCode = Integer.parseInt(code, 16);
        Class<YkrPileStopReasonEnum> enumClass = YkrPileStopReasonEnum.class;
        for (YkrPileStopReasonEnum elecPileStopReasonEnum : enumClass.getEnumConstants()) {
            if (intCode == elecPileStopReasonEnum.getCode()) {
                return elecPileStopReasonEnum.getMsg();
            }
        }
        return "该停止方式未知:" + intCode;

    }

    private int code;
    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
